home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gui4cli.lha
/
Gui4Cli
/
Docs
/
Tutorials
/
ListViews2.gc
< prev
next >
Wrap
Text File
|
1999-04-21
|
3KB
|
84 lines
G4C
; MULTISELECT LISTVIEWS
; This is an example of multiselect listviews.
; Here again we have to give a file name which the listview will
; display.
; We'll display the "guis:docs/printme" file in one and nothing in
; the other. The button transfers the selected lines
WINBIG -1 -1 414 186 ListViews2.gc
WinType 11110001
BOX 0 0 0 0 out button
xOnLoad
GuiOpen ListViews2.gc
xOnClose
GuiQuit ListViews2.gc
; ----------------------------------------------------------
; The 2 listviews
; ----------------------------------------------------------
; Note that a multiselect lv will "happen" whenever the user double
; clicks on an item. Here, we'll not do anything when the user
; double clicks.. (that's why the lv's don't have any commands attached)
; ---- The Top listview
XLISTVIEW 4 2 405 98 "" Top.lv "guis:docs/printme" 10 MULTI
gadid 1
; we'll give this one a monospace font..
gadfont #mono 8 000
; ---- The bottom listview (no file)
XLISTVIEW 5 108 405 76 "" Bottom.lv "" 10 MULTI
GadID 2
; ----------------------------------------------------------
; A button to transfer selected items
; ----------------------------------------------------------
; to do this we have to use the lvmulti command to see which of the
; lines in the Top listview have been selected. We use the internal
; variables to get our results - yes.. go read all about them..
XBUTTON 4 94 361 14 "Copy Selected items to Bottom Listview -->>"
lvuse listviews2.gc 1 ; use the Top listview
lvmulti first ; get the first selected record
while $$lv.line > '' ; while there *are* selected items
dummy = $$lv.rec ; store the selected line into a variable
lvuse listviews2.gc 2 ; use the other (Bottom) listview
lvadd $dummy ; append the line to it
lvuse listviews2.gc 1 ; use the Top listview again
lvmulti off ; unselect the line we just transfered
lvmulti next ; get the next selected line
endwhile ; .. until there are no more - i.e., until
; the $$lv.line internal variable = ''
; Note that in Gui4Cli 0 is a valid number.
; The top line of a listview is the 0th line.
; This may seem confusing in the begining but there is a weird kind of
; sense in it, so bear with me..
; When the Current Line is the top line, then $$lv.line = 0
; When Gui4Cli runs out of selected lines, the current line will
; be set to nothing (i.e. $$lv.line = '') and that's how we know that
; we're finished.
; That's why we use the - while $$lv.line > '' - comparison above